package com.link4a.doms.web;


/**
 * @author brown
 */
public abstract class ControllerSupport {

	public final JsonResult success() {
		return new JsonResult(JsonResult.SUCCESS);
	}

	public final JsonResult success(String message, Object data) {
		return new JsonResult(JsonResult.SUCCESS, message, data);
	}

	public final JsonResult success(Object data) {
		return new JsonResult(JsonResult.SUCCESS, null, data);
	}

	public final JsonResult fail() {
		return new JsonResult(JsonResult.FAIL);
	}

	public final JsonResult fail(String message) {
		return new JsonResult(JsonResult.FAIL, message);
	}
	
	public final JsonResult fail(String message, Object data) {
		return new JsonResult(JsonResult.FAIL, message, data);
	}

	public final JsonResult error() {
		return new JsonResult(JsonResult.ERROR);
	}

	public final JsonResult error(String message) {
		return new JsonResult(JsonResult.ERROR, message);
	}
	
	public final JsonResult result(int code) {
		return new JsonResult(code);
	}
	
	public final JsonResult result(int code, String message) {
		return new JsonResult(code, message);
	}
	
	public final JsonResult result(int code, String message, Object data) {
		return new JsonResult(code, message, data);
	}

}
